
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
Naming controls </TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="pbugp102.htm">Previous</A>&nbsp;&nbsp;<A HREF="pbugp104.htm" >Next</A>
<!-- End Header -->
<A NAME="X-REF298661128"></A><h1>Naming controls </h1>
<A NAME="TI2687"></A><p>When you place a control in a window, PowerBuilder assigns
it a unique name. The name is the concatenation of the default prefix
for the control name and the lowest 1- to 4-digit number that makes
the name unique.</p>
<A NAME="TI2688"></A><p>For example, assume the prefix for ListBoxes is <b>lb_</b> and
you add a ListBox to the window:</p>
<A NAME="TI2689"></A><p><A NAME="TI2690"></A>
<ul>
<li class=fi>If the names <b>lb_1</b>, <b>lb_2</b>,
and <b>lb_3</b> are currently used, the default
name is <b>lb_4</b></li>
<li class=ds>If <b>lb_1</b> and <b>lb_3</b> are
currently used but <b>lb_2</b> is not, the
default name is <b>lb_2</b>
</li>
</ul>
</p>
<A NAME="TI2691"></A><h2>About the default prefixes</h2>
<A NAME="TI2692"></A><p>Each type of control has a default prefix for its name. <A HREF="pbugp103.htm#CIHFAEIB">Table 12-1</A> lists the initial default
prefix for each control (note that there is no prefix for a window).</p>
<A NAME="CIHFAEIB"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 12-1: Default prefixes for window control
names</caption>
<tr><th  rowspan="1"  ><A NAME="TI2693"></A>Control</th>
<th  rowspan="1"  ><A NAME="TI2694"></A>Prefix</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2695"></A>Animation</td>
<td  rowspan="1"  ><A NAME="TI2696"></A>am_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2697"></A>CheckBox</td>
<td  rowspan="1"  ><A NAME="TI2698"></A>cbx_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2699"></A>CommandButton</td>
<td  rowspan="1"  ><A NAME="TI2700"></A>cb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2701"></A>DataWindow</td>
<td  rowspan="1"  ><A NAME="TI2702"></A>dw_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2703"></A>DatePicker</td>
<td  rowspan="1"  ><A NAME="TI2704"></A>dp_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2705"></A>DropDownListBox</td>
<td  rowspan="1"  ><A NAME="TI2706"></A>ddlb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2707"></A>DropDownPictureListBox</td>
<td  rowspan="1"  ><A NAME="TI2708"></A>ddplb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2709"></A>EditMask</td>
<td  rowspan="1"  ><A NAME="TI2710"></A>em_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2711"></A>Graph</td>
<td  rowspan="1"  ><A NAME="TI2712"></A>gr_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2713"></A>GroupBox</td>
<td  rowspan="1"  ><A NAME="TI2714"></A>gb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2715"></A>HProgressBar</td>
<td  rowspan="1"  ><A NAME="TI2716"></A>hpb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2717"></A>HScrollBar</td>
<td  rowspan="1"  ><A NAME="TI2718"></A>hsb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2719"></A>HTrackBar</td>
<td  rowspan="1"  ><A NAME="TI2720"></A>htb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2721"></A>InkEdit</td>
<td  rowspan="1"  ><A NAME="TI2722"></A>ie_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2723"></A>InkPicture</td>
<td  rowspan="1"  ><A NAME="TI2724"></A>ip_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2725"></A>Line</td>
<td  rowspan="1"  ><A NAME="TI2726"></A>ln_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2727"></A>ListBox</td>
<td  rowspan="1"  ><A NAME="TI2728"></A>lb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2729"></A>ListView</td>
<td  rowspan="1"  ><A NAME="TI2730"></A>lv_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2731"></A>MonthCalendar</td>
<td  rowspan="1"  ><A NAME="TI2732"></A>mc_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2733"></A>MultiLineEdit</td>
<td  rowspan="1"  ><A NAME="TI2734"></A>mle_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2735"></A>OLE 2.0</td>
<td  rowspan="1"  ><A NAME="TI2736"></A>ole_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2737"></A>Oval</td>
<td  rowspan="1"  ><A NAME="TI2738"></A>ov_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2739"></A>Picture</td>
<td  rowspan="1"  ><A NAME="TI2740"></A>p_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2741"></A>PictureHyperLink</td>
<td  rowspan="1"  ><A NAME="TI2742"></A>phl_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2743"></A>PictureButton</td>
<td  rowspan="1"  ><A NAME="TI2744"></A>pb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2745"></A>PictureListBox</td>
<td  rowspan="1"  ><A NAME="TI2746"></A>plb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2747"></A>RadioButton</td>
<td  rowspan="1"  ><A NAME="TI2748"></A>rb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2749"></A>Rectangle</td>
<td  rowspan="1"  ><A NAME="TI2750"></A>r_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2751"></A>RichTextEdit</td>
<td  rowspan="1"  ><A NAME="TI2752"></A>rte_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2753"></A>RoundRectangle</td>
<td  rowspan="1"  ><A NAME="TI2754"></A>rr_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2755"></A>SingleLineEdit</td>
<td  rowspan="1"  ><A NAME="TI2756"></A>sle_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2757"></A>StaticText</td>
<td  rowspan="1"  ><A NAME="TI2758"></A>st_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2759"></A>StaticHyperLink</td>
<td  rowspan="1"  ><A NAME="TI2760"></A>shl_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2761"></A>Tab</td>
<td  rowspan="1"  ><A NAME="TI2762"></A>tab_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2763"></A>TreeView</td>
<td  rowspan="1"  ><A NAME="TI2764"></A>tv_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2765"></A>User Object</td>
<td  rowspan="1"  ><A NAME="TI2766"></A>uo_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2767"></A>VProgressBar</td>
<td  rowspan="1"  ><A NAME="TI2768"></A>vpb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2769"></A>VScrollBar</td>
<td  rowspan="1"  ><A NAME="TI2770"></A>vsb_</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI2771"></A>VTrackBar</td>
<td  rowspan="1"  ><A NAME="TI2772"></A>vtb_</td>
</tr>
</table>
<A NAME="TI2773"></A><h3>Changing the default prefixes</h3>
<A NAME="TI2774"></A><p>You can change the default prefixes for controls in the Window
painter's Options dialog box. Select Design&gt;Options
from the menu bar to open the Options dialog box. The changes you
make are saved in the PowerBuilder initialization file. For more
about the PowerBuilder initialization file, see <A HREF="pbugp23.htm#X-REF304001355">"How the PowerBuilder
environment is managed"</A>.</p>
<A NAME="TI2775"></A><h2>Changing
the name</h2>
<A NAME="TI2776"></A><p>You should change the default suffix to a suffix that is meaningful
in your application. For example, if you have command buttons that
update and retrieve database information, you might call them <b>cb_update</b> and <b>cb_retrieve</b>. If
you have many controls on a window, using intuitive names makes
it easier for you and others to write and understand scripts for
these controls.</p>
<A NAME="TI2777"></A><p>Using application-based names instead of sequential numbers
also minimizes the likelihood that you will have name conflicts
when you use inheritance to create windows.</p>
<A NAME="TI2778"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To change a control's name:</p>
<ol><li class=fi><p>Select the control to display the control's
properties in the Properties view.</p></li>
<li class=ds><p>On the General tab page, select the application-specific
suffix (for example, the <FONT FACE="Courier New">1 </FONT>in
the <FONT FACE="Courier New">cb_1 </FONT>command
button name) and type a more meaningful one. </p><p>You can use any valid PowerBuilder identifier with up to 255
characters. For information about PowerBuilder identifiers, see
the <i>PowerScript Reference.</i>
</p></li></ol>
<br>
